package com.xyw.code.platform.common.entity.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 系统日志
 * </p>
 *
 * @author xyw
 * @since 2020-02-17
 */
@TableName("sys_log")
@Data
public class SysLog extends Model<SysLog> {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId(type = IdType.ID_WORKER_STR)
    private String id;
    /**
     * 操作IP
     */
    @TableField("request_ip")
    private String requestIp;
    /**
     * 操作类型 1 操作记录2异常记录 3登录记录
     */
    private Integer type;
    /**
     * 操作人
     */
    @TableField("user_name")
    private String userName;
    /**
     * 操作描述
     */
    private String description;
    /**
     * 请求方法
     */
    @TableField("action_method")
    private String actionMethod;
    @TableField("action_url")
    private String actionUrl;
    /**
     * 请求参数
     */
    private String params;
    /**
     * 浏览器
     */
    private String ua;
    /**
     * 类路径
     */
    @TableField("class_path")
    private String classPath;
    /**
     * 请求方法
     */
    @TableField("request_method")
    private String requestMethod;
    /**
     * 开始时间
     */
    @TableField("start_time")
    private Date startTime;
    /**
     * 完成时间
     */
    @TableField("finish_time")
    private Date finishTime;
    /**
     * 消耗时间
     */
    @TableField("consuming_time")
    private Long consumingTime;
    /**
     * 异常详情信息
     */
    @TableField("ex_desc")
    private String exDesc;
    /**
     * 异常描述
     */
    @TableField("ex_detail")
    private String exDetail;

    /**
     *  是否删除  -1：已删除  0：正常
     */
    @TableField("del_flag")
    private Integer delFlag;

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    @Override
    public String toString() {
        return "SysLog{" +
        ", id=" + id +
        ", requestIp=" + requestIp +
        ", type=" + type +
        ", userName=" + userName +
        ", description=" + description +
        ", actionMethod=" + actionMethod +
        ", actionUrl=" + actionUrl +
        ", params=" + params +
        ", ua=" + ua +
        ", classPath=" + classPath +
        ", requestMethod=" + requestMethod +
        ", startTime=" + startTime +
        ", finishTime=" + finishTime +
        ", consumingTime=" + consumingTime +
        ", exDesc=" + exDesc +
        ", exDetail=" + exDetail +
        "}";
    }
}
